package com.xbongbong.saas.model;

import com.xbongbong.paas.toolbox.wrap.IModel;
import com.xbongbong.saas.domain.entity.StageWorkEntity;

import java.util.List;
import java.util.Map;

/**
 * @author haibin.zhang
 * @version v1.0
 * @date 2019/2/13 15:12
 * @since v1.0
 */
public interface StageWorkModel extends IModel<StageWorkEntity> {

    @Override
    List<StageWorkEntity> findEntitys(Map<String, Object> param);

    List<StageWorkEntity> getDefaultList(Integer businessType);

    void insertBatch(List<StageWorkEntity> workList);

    void deleteBatch(List<Long> dbWorkIdList);

    void updateBatch(List<StageWorkEntity> stageWorkEntityList, String corpid);

    void updateBatch4MirrorRollback(List<StageWorkEntity> stageWorkEntityList, String corpid);

    void updateBatch4Script(List<StageWorkEntity> stageWorkEntityList);

    StageWorkEntity getByKey(Long key, String corpid);

    Integer delete(StageWorkEntity entity);

    /**
     * 判断是否没有任务或者任务占比等于0
     *
     * @param corpid
     * @param formId
     * @param stageProcessId
     * @param stageId
     * @param businessType
     * @param saasMark
     * @return
     */
    boolean isNoWorkOrProportionEqualsZero(String corpid, Long formId, Long stageProcessId, Long stageId, Integer businessType, Integer saasMark);

    /**
     * 阶段任务排序
     * @param corpid 公司id
     * @param formId 表单id
     * @param sortMap 排序map
     */
    void sort(String corpid, Long formId, Map<Long,Integer> sortMap);
}
